<template>
  <div class="app">
    <div v-if="isShow">
      <input type="text" v-model="info" ref="inputRef">
      <button @click="isShow = false">确定</button>
    </div>
    <div v-else>
      {{ info }}
      <button @click="edit">编辑</button>
    </div>

  </div>
</template>

<script>
export default {
  data() {
    return {
      info: '你好',
      isShow: false
    }
  },
  methods: {
    async edit() {
      this.isShow = true
      await this.$nextTick()
      this.$refs.inputRef.focus()
    }
  }
}

</script>

<style></style>